<template>
	<view>
		<u-button text="扫码" type="primary" @click="scanCode"></u-button>
		<navigator url="/pages/addProduct/addProduct" hover-class="navigator-hover">
			<u-button text="录入商品"></u-button>
		</navigator>
	</view>
</template>

<script>
	export default {
		data() {
			return {

			};
		},
		methods: {
			scanCode() {
				// 调起条码扫描
				uni.scanCode({
					scanType: ['barCode'],
					success: function(res) {
						console.log('条码类型：' + res.scanType);
						console.log('条码内容：' + res.result);
					},
					complete: function(res) {
						console.log('条码类型：' + res.scanType);
						console.log('条码内容：' + res.result);
					}
				});
			}
		}
	}
</script>

<style lang="scss">

</style>